//
//  Singleton.m
//  MusicPlayer
//
//  Created by dlios on 15-5-26.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "Singleton.h"

static Singleton *singleton = nil;

@implementation Singleton

+ (Singleton *)shareManager
{
    static dispatch_once_t once;
    
    dispatch_once(&once, ^{
        if (!singleton) {
            singleton = [[Singleton alloc] init];
            singleton.array = [NSMutableArray array];
            singleton.songListArray = [NSMutableArray array];
            singleton.songArray = [NSMutableArray array];
        }
    });
    
    return singleton;
}

// 自定义单例播放方法
- (void)playWithUrl:(NSString *)url
{
    // 播放之前先停止在播歌曲
    [self stop];
    self.audio = [[STKAudioPlayer alloc] init];
    [self.audio play:url];
    
}

// 自定义播放停止方法
- (void)stop
{
    if (self.audio) {
        [self.audio stop];
    }
}
@end
